#!/usr/bin/python
#-*- coding: UTF-8 -*-
import time
import pymysql
from ext import db
from flask_login import UserMixin

class TodoList(db.Model):
    __tablename__ = 'todolist'
    id = db.Column(db.Integer, primary_key=True)
    user_id = db.Column(db.Integer, nullable=False)
    equipmnet = db.Column(db.String(256), nullable=True)
    xinghao = db.Column(db.String(256), nullable=False)
    bumen = db.Column(db.Integer, nullable=False)
    owner = db.Column(db.String(256), nullable=False)
    dispaly = db.Column(db.String(256), nullable=False)
    cpu = db.Column(db.String(256), nullable=False)
    memory = db.Column(db.String(256), nullable=False)
    disk = db.Column(db.String(256), nullable=False)
    mac_addr = db.Column(db.String(256), nullable=False)
    guzhang = db.Column(db.String(4), nullable=False)
    create_time = db.Column(db.String(256), nullable=True)

    def __init__(self, user_id,equipmnet, xinghao,bumen,owner,dispaly,cpu,memory,disk,mac_addr,guzhang,create_time):
        self.user_id = user_id
        self.equipmnet = equipmnet
        self.xinghao = xinghao
        self.bumen = bumen
        self.owner = owner
        self.dispaly = dispaly
        self.cpu = cpu
        self.memory = memory
        self.disk = disk
        self.mac_addr = mac_addr
        self.guzhang = guzhang
        self.create_time = create_time


class User(UserMixin, db.Model):
    __tablename__ = "user"
    id = db.Column(db.Integer, primary_key=True)
    username = db.Column(db.String(24), nullable=False)
    password = db.Column(db.String(24), nullable=False)

    def __init__(self, username, password):
        self.username = username
        self.password = password

class xiang(UserMixin, db.Model):
    __tablename__ = "xiang"
    id = db.Column(db.Integer, primary_key=True)
    example = db.Column(db.String(24), nullable=False)
    key = db.Column(db.String(24), nullable=False)

    def __init__(self, example, key):
        self.example = example
        self.key = key